package com.example.springboothomework.entity.dto;

import com.example.springboothomework.validator.ValidGroup;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.*;
import java.time.LocalDate;

/**
 * @author: chenjianhao
 * @date: 2025/6/5
 *
 * 员工DTO
 */
@Getter
@Setter
public class EmployeeDTO {

    @Null(groups = ValidGroup.Save.class,message = "新增员工时ID必须为空")
    @NotNull(groups = ValidGroup.Update.class,message = "员工ID不能为空")
    private Long id;
    
    @NotBlank(message = "员工姓名不能为空")
    @Size(min = 2, max = 100, message = "员工姓名长度需在2-100字符之间")
    @Pattern(regexp = ".*\\S.*", message = "员工姓名不能全为空白字符")
    private String name;
    
    @NotNull(message = "入职日期不能为空")
    @PastOrPresent(message = "入职日期不能是未来时间")
    private LocalDate employmentDate;
    
    @NotNull(message = "年龄不能为空")
    private Integer age;
    
    @NotNull(message = "在职状态不能为空")
    private Boolean employed;
    
    @NotNull(message = "所属公司不能为空")
    private Long companyId;
}